import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

// 引入ElementUI，全局注册
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

// 引入app 注册根组件
import App from './App'
// 引入VUex-store , 挂载VUex-store
import store from './store'
// 引入路由router,挂载 路由
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import Component from '@/components'

import * as directives from '@/directives'
import * as filters from '@/filters/index' 
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// 因为要使用真正的数据，所以不需要模拟数据
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

// for in
// console.log(directives)
Object.keys(directives).forEach(key => {
  Vue.directive(key,directives[key]) // 注册自定义指令
})

// 注册全局通用工具栏
Vue.use(Component)

 // 事件过滤器
 Object.keys(filters).forEach(key => {
  Vue.filter(key,filters[key])
})


Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
